package org.intelligentsia.temporal.series;

import org.intelligentsia.temporal.Temporal;
import org.intelligentsia.temporal.TransactionTime;

public class SerieData implements Temporal {
	/**
	 * Universal Identifier of series.
	 */
	private String			guid;
	/**
	 * version for transaction update.
	 */
	private long			version;
	/**
	 * Identifier of this item.
	 */
	private long			transactionIdentifier;
	/**
	 * time of transaction.
	 */
	private TransactionTime	transactionTime;

	/**
	 * Build a new instance of <code>SerieData</code>.
	 */
	public SerieData() {
		super();
	}

	public long getTransactionIdentifier() {
		return transactionIdentifier;
	}

	public void setTransactionIdentifier(final long transactionIdentifier) {
		this.transactionIdentifier = transactionIdentifier;
	}

	public String getGuid() {
		return guid;
	}

	public void setGuid(final String guid) {
		this.guid = guid;
	}

	public long getVersion() {
		return version;
	}

	public void setVersion(final long version) {
		this.version = version;
	}

	@Override
	public TransactionTime getTransactionTime() {
		return transactionTime;
	}

	@Override
	public void setTransactionTime(final TransactionTime transactionTime) {
		this.transactionTime = transactionTime;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((guid == null) ? 0 : guid.hashCode());
		result = prime * result + (int) (transactionIdentifier ^ (transactionIdentifier >>> 32));
		result = prime * result + ((transactionTime == null) ? 0 : transactionTime.hashCode());
		result = prime * result + (int) (version ^ (version >>> 32));
		return result;
	}

	@Override
	public boolean equals(final Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		final SerieData other = (SerieData) obj;
		if (guid == null) {
			if (other.guid != null) {
				return false;
			}
		} else if (!guid.equals(other.guid)) {
			return false;
		}
		if (transactionIdentifier != other.transactionIdentifier) {
			return false;
		}
		if (transactionTime == null) {
			if (other.transactionTime != null) {
				return false;
			}
		} else if (!transactionTime.equals(other.transactionTime)) {
			return false;
		}
		if (version != other.version) {
			return false;
		}
		return true;
	}

}
